package javax.realtime;

import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;

public abstract class MemoryArea {

	private Runnable runnable;
	
	protected MemoryArea(long size)
	{
		this(size, null);		
	}
	protected MemoryArea(long size, Runnable logic)
	{
		if(size < 0) throw new IllegalArgumentException();
		runnable = logic;
	}
	protected MemoryArea(SizeEstimator size)
	{
		this(size, null);
	}
	protected MemoryArea(SizeEstimator size, Runnable logic)
	{
		if(size == null) throw new IllegalArgumentException();
		if(size.getEstimate() < 0) throw new IllegalArgumentException();
		runnable = logic;
	}
	
	public void enter()
	{
		
	}
	public void enter(Runnable logic)
	{
		
	}
	public void executeInArea(Runnable logic)
	{
		
	}
	public static MemoryArea getMemoryArea(Object object)
	{
		//TODO: stub
		if(object == null) throw new IllegalArgumentException();
		return null;
	}
	public long memoryConsumed()
	{
		//TODO: stub
		return 0;
	}
	public long memoryRemaining()
	{
		//TODO: stub
		return 0;
	}
	public Object newArray(Class type, int number)
	{
		//TODO: stub
		return null;
	}
	public Object newInstance(Class type) throws InstantiationException, IllegalAccessException
	{
		//TODO: stub
		return null;
	}
	public Object newInstance(Constructor c, Object[] args) throws IllegalAccessException, InstantiationException, InvocationTargetException
	{
		//TODO: stub
		return null;
	}
	public long size()
	{
		//TODO: stub
		return 0;
	}
}
